package anonymouschat.messages.securitymessages;

import anonymouschat.client.PublicIdentity;

/**
 * This is a message that is encrypted by RSA.
 * 
 * @author bh349
 * 
 */
public class RSAEncryptedMessage extends EncryptedMessage {
	private static final long serialVersionUID = 1L;
	private String destUserName;
	private String srcUserName;
	private PublicIdentity publicIdentity;
	private boolean goingUp = true;

	/**
	 * Construct an RSAEncryptedMessage using encrypted data and target user
	 * name.
	 * 
	 * @param encryptedData
	 * @param dstUserName
	 */
	public RSAEncryptedMessage(byte[] encryptedData, String dstUserName,
			PublicIdentity srcUser) {
		super(encryptedData);
		this.destUserName = dstUserName;
		this.srcUserName = srcUser.getUserName();
		this.publicIdentity = srcUser;
	}

	public String getDstUserName() {
		String temp = destUserName;
		return temp;
	}

	public String getSrcUserName() {
		String temp = srcUserName;
		return temp;
	}

	public PublicIdentity getPublicIdentity() {
		PublicIdentity temp = publicIdentity;
		return temp;
	}

	@Override
	public String getAllContents() {
		return "Encrypted RSAMessage";
	}

	public void setGoingUpFalse() {
		this.goingUp = false;
	}

	public boolean isGoingUp() {
		return this.goingUp;
	}

}
